require 'sinatra'
require 'rack-weixin'

use Weixin::Middleware, 'xiaonanmen', '/weixin' 

configure do
  set :wx_id, 'wxf5d4d0f2c8f6c070'
end

get '/vote/:code' do |c|
  @title = "小南门内参の人气评选"
  case params[:code]
  when "bk"
    @title = "北京科技大学人气歌手投票"
  when "mz"
    @title = "中央民族大学人气歌手投票"
  when "bj"
    @title = "北京交通大学人气歌手投票"
  when "by"
    @title = "北京语言大学人气歌手投票"
  when 'uibe'
    @title = '对外经贸大学十佳歌手|内附歌曲音频'
  when "bh"
    @title = '北京航空航天大学十佳歌手|内附歌曲音频'
  when 'zc'
    @title = "中央财经大学人气歌手投票"
  when 'bnu'
    @title = "北京师范大学人气歌手投票"
  when 'zf'
    @title = "中国政法大学人气歌手投票"
  end
  if params[:user]
    #client = Weixin::Client.new('wxf5d4d0f2c8f6c070', '4fb9f4c1028516fe8a6dd176c9a6f98a')
    #@info = client.user.info(params[:user])
    erb :vote_plus
  else
    erb :vote
  end
end

get "/weixin" do
  params[:echostr]
end

post "/weixin" do
  content_type :xml, 'charset' => 'utf-8'
  message = request.env[Weixin::Middleware::WEIXIN_MSG]
  msg_router(message) unless message.nil?
end

helpers do
  def msg_router(msg)
    #TODO: Move to LeanCloud
    bnu_index = Hash["李悦" => "01", "王境驰" => "02", "姚汶汐" => "03", "翟浩宇" => "04", 
      "CBD91组合" => "05", "唱钊赫" => "06", "毛子晴" => "07", "郑奕聪" => "08", "任璐" => "09", "丁志衡" => "10"]
    by_index = Hash["林宜龙" => "01", "蔡伊德" => "02", "卢汶鸣" => "03", "米克尔" => "03", "卢米" => "03", "董朱易" => "04", 
      "高云鹏" => "05", "黄俏" => "06", "富莎莎" => "07", "任刚训" => "08", "张晨曦" => "09", "李珊冰" => "10"]
    bk_index = Hash["文兆杰" => "01", "潘洵峤" => "02", "孙天宇" => "03", "梁言" => "04", "滚雪" => "05", 
      "张誉" => "06", "张海飞" => "07", "吴求" => "08", "李彦潮" => "09", "苏琬茵" => "10"]
    bj_index = Hash["白杰" => "01", "杨杨" => "02", "徐鹤" => "03", "张万鹏" => "04", "许恩淑" => "05", 
      "达山" => "06", "于欢" => "07", "白金" => "08"]
    uibe_index = Hash["肖垚" => "01", "陈鹏万里" => "02", "次仁央宗" => "03", "卓玛" => "03", "关焯文" => "04", "马樱菲" => "05", 
      "刘泽宁" => "06", "王悦" => "07", "唐子安" => "08", "于昊媛" => "09", "陈诺" => "10"]
    bh_index = Hash["孔令萩" => "01", "钟媛" => "02", "巴郎仔组合" => "03", "李佳龙" => "04", "李鸥" => "05", 
      "一个人组合" => "06", "安康" => "07", "孙蔚杰" => "08", "冯鑫程" => "09", "张陈扬" => "10"]
    zc_index = Hash["张筱祎" => "01", "Old Driver" => "02", "梁振锋" => "03", "张孟森" => "04", "陈昱青" => "05", 
      "矩阵乐队" => "06", "楚浩良" => "07", "Angel Wings" => "08", "邝继彬" => "09", "郭娜" => "10", "曲天洪" => "11", 
      "施诚杰" => "12", "卡玛" => "13", "康晋源" => "14", "郑贤宇" => "15", "李泰勋" => "16", "朗靖南" => "17", 
      "庞娜" => "18", "扎西格勒" => "19"]
    zf_index = Hash["孙重科" => "01", "幺蛾子" => "02", "张鑫" => "03", "高雨" => "04", 
      "丹臻群佩" => "05", "成前" => "06", "罗凯元" => "07", "王奥" => "08"]
    zc_url = Hash["张筱祎" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000326&idx=1&sn=42413d077ae3ecace80cc7bd8b1e9ae1#rd",
      "Old Driver" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000314&idx=1&sn=bff1782a59bf4e65e9edc401a3e777c9#rd", 
      "梁振锋" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000316&idx=1&sn=e7497789c538bfafb21048403cf7202e#rd", 
      "张孟森" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000305&idx=1&sn=69b8cd0285534b164fe924fc7fd1c44c#rd", 
      "陈昱青" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000307&idx=1&sn=38a1f5cc7d3c02e502e2e9c1e9567fab#rd", 
      "矩阵乐队" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000293&idx=1&sn=24708a20e9e061c5ab99fad030b72bc2#rd", 
      "楚浩良" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000318&idx=1&sn=20fba9146d84bea6fbf38d4d41bb706f#rd", 
      "Angel Wings" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000311&idx=1&sn=d8fffb7fbf26e085820a4cdd066d7d64#rd", 
      "邝继彬" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000309&idx=1&sn=af5bbe106c38610ea8f2732700d7174c#rd", 
      "郭娜" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000299&idx=1&sn=585dced3076e87c642668618c5b2826f#rd",
      "曲天洪" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000320&idx=1&sn=277f7c864ee30b44ae38bbdccb68ad01#rd",
      "施诚杰" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000322&idx=1&sn=39a97ccf5871bf7344b45131cc8f859d#rd", 
      "卡玛" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000353&idx=1&sn=81faf36bb474cd1ef068bd74a707dc5f#rd", 
      "康晋源" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000324&idx=1&sn=ea9fc5170cc007bc1c1b1867056f1abe#rd", 
      "郑贤宇" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000297&idx=1&sn=132e6402d596f547494ea513720f077e#rd", 
      "李泰勋" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000328&idx=1&sn=4ddb4d579cf5efd8970e5a7dcb5b01ac#rd", 
      "朗靖南" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000303&idx=1&sn=b440cf7e6cbf1b013e3b70ba006c8ce0#rd", 
      "庞娜" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000295&idx=1&sn=7050cf7b41d8297727def808c2587a77#rd", 
      "扎西格勒" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000301&idx=1&sn=500c9302db70dc902acca172d3df1180#rd"] 
    bh_url = Hash["孔令萩" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000279&idx=1&sn=0aaa7d89f641444210cfbbed40b4e01b#rd",
      "钟媛" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000273&idx=1&sn=6fe407355cdf2261a515eb80ac2ecba0#rd", 
      "巴郎仔组合" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000271&idx=1&sn=20e49648debdb7c9ea75fb9eb30cb352#rd", 
      "李佳龙" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000277&idx=1&sn=8c1bb7e0b643cae5740e1984fa938090#rd", 
      "李鸥" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000275&idx=1&sn=2b4f96db65a81d41957f7447d40dac83#rd", 
      "一个人组合" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000269&idx=1&sn=4a452f56b0ebe6c3e4c816a2a7e5fb72#rd", 
      "安康" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000283&idx=1&sn=b09059bf7ce6faadc8719be8089e18fb#rd", 
      "孙蔚杰" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000285&idx=1&sn=9f327a9e45c41f3c903b06f5654a1ad6#rd", 
      "冯鑫程" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000281&idx=1&sn=53af94aab9726589b1475247bc11b5b8#rd", 
      "张陈扬" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000288&idx=1&sn=e4709e3b4d8471700c903a38d787eb93#rd"] 
    uibe_url = Hash["肖垚" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000215&idx=1&sn=6f6fe1f01bd69e64e6077bfed26a571e#rd",
      "陈鹏万里" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000199&idx=1&sn=248d562d18eeda9602670cf66e47096a#rd", 
      "次仁央宗" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000201&idx=1&sn=ff6f4cf9d2a209524ae7e6ac1d1121ce#rd", 
      "卓玛" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000201&idx=1&sn=ff6f4cf9d2a209524ae7e6ac1d1121ce#rd", 
      "关焯文" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000211&idx=1&sn=5e1c5c68f2a2a2c67bae43a65f8f3321#rd", 
      "马樱菲" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000209&idx=1&sn=f848a1b26f83851e3323dae19c4b24a6#rd", 
      "刘泽宁" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000205&idx=1&sn=1df9d3497f9013256d222644386bc15a#rd", 
      "王悦" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000213&idx=1&sn=eb58c821a8be6f8d4bb5fdb59cfa9c14#rd", 
      "唐子安" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000202&idx=1&sn=abb02c3f51db391dcb0129ba14874161#rd", 
      "于昊媛" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000207&idx=1&sn=4eef2b56c8137d833fa73e0deb45fee9#rd",
      "陈诺" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000217&idx=1&sn=66ea93639e0e18f2e338ea0f59d6f9ca#rd"]
    by_url = Hash["林宜龙" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000134&idx=1&sn=f8f540897d8c66957d5e9b7b04b69997#rd",
      "蔡伊德" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000146&idx=1&sn=9d52d3dce1695fb92123b90cc37f7e06#rd", 
      "卢汶鸣" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000130&idx=1&sn=24f387f0c2a7942cf30d233200a89f5b#rd", 
      "米克尔" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000130&idx=1&sn=24f387f0c2a7942cf30d233200a89f5b#rd", 
      "卢米" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000130&idx=1&sn=24f387f0c2a7942cf30d233200a89f5b#rd", 
      "董朱易" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000140&idx=1&sn=280f648559a72e320e6e105c0578be23#rd", 
      "高云鹏" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000138&idx=1&sn=cc3976280297b70f5af1501c1499e22e#rd", 
      "黄俏" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000132&idx=1&sn=e35626292682744d735eaa83cb58fe2d#rd", 
      "富莎莎" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000142&idx=1&sn=1da9166acc224323df79636da739eb05#rd", 
      "任刚训" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000148&idx=1&sn=ccaabfed155c3ec9dc4561f107fc80df#rd",
      "张晨曦" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000136&idx=1&sn=994d46fc87f62c5739554dc2d87f3a62#rd",
      "李珊冰" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000144&idx=1&sn=73832fffc73a3bb43e6e73975819c16f#rd"]
    bk_url = Hash["文兆杰" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000113&idx=1&sn=8aac4a35e78e97a49f6edb602cc4053a#rd",
      "潘洵峤" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000116&idx=1&sn=ca619c4c6c1dd6328189a0c78b776e76#rd", 
      "孙天宇" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000115&idx=1&sn=3a7301884ac35a1b3bad85b49e9819d1#rd", 
      "梁言" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000121&idx=1&sn=7de2cd78c4895a9b1e0815ddd787cca2#rd", 
      "滚雪" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000097&idx=1&sn=b96bfb4e11bc3eb69df03233cefff659#rd", 
      "张誉" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000110&idx=1&sn=6eaa92ec1e38f0768b31d0d6e7064b6c#rd", 
      "张海飞" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000123&idx=1&sn=c2fb7569e0e905f10b54de47f4630575#rd", 
      "吴求" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000128&idx=1&sn=ce435427322455a009d55b106b6efe92#rd", 
      "李彦潮" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000119&idx=1&sn=fa774a43915fbd90523a8348393b1530#rd", 
      "苏琬茵" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000125&idx=1&sn=55c984ceac1681af09ced8c54606676f#rd"]
    bj_url = Hash["白杰" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000184&idx=1&sn=38e785cd894742e37ae2c49b8c63ebe6#rd",
      "杨杨" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000172&idx=1&sn=7e6bf1a83d145961c585114a397af71c#rd", 
      "徐鹤" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000174&idx=1&sn=d00f2a13763b14bd3439ba5f19212abc#rd", 
      "张万鹏" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000180&idx=1&sn=7b23906666afd6d2db10f0c0cd0ed789#rd", 
      "许恩淑" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000182&idx=1&sn=85b03ab5054bd62590495af3575c4d61#rd", 
      "达山" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000186&idx=1&sn=c8543b2d7a4723a4da28527d923f70af#rd", 
      "于欢" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000176&idx=1&sn=9f7d9bb955da81db814cc8d6860dca44#rd", 
      "白金" => "http://mp.weixin.qq.com/s?__biz=MzI0MDI5NzI1OQ==&mid=100000178&idx=1&sn=9d8c97a07fd412c5a8c10a8c99c7bb74#rd"]
    by_vote = Weixin.item("北语人气歌手投票｜这次你们会把谁推上谜の人气的宝座？", "国际纵队来袭", 
      "http://fanhe-photo.b0.upaiyun.com/voter/by_vote_cover.jpg", "http://xnm.fanheapp.com/vote/by?user=#{msg.FromUserName}")
    bk_vote = Weixin.item("北科大人气歌手投票｜这次你们会把谁推上谜の人气的宝座？", "这一次，只有三票", 
      "http://fanhe-photo.b0.upaiyun.com/voter/bk_vote_cover.jpg", "http://xnm.fanheapp.com/vote/bk?user=#{msg.FromUserName}")
    bj_vote = Weixin.item("北交大人气歌手投票｜这次你们会把谁推上谜の人气的宝座？", "请投出宝贵的三票", 
      "http://fanhe-photo.b0.upaiyun.com/voter/bj_vote_cover.jpg", "http://xnm.fanheapp.com/vote/bj?user=#{msg.FromUserName}")
    mz_vote = Weixin.item("民大人气歌手投票｜这次你们会把谁推上谜の人气的宝座？", "投票呀，废什么话", 
      "http://fanhe-photo.b0.upaiyun.com/voter/vote_cover.jpg", "http://xnm.fanheapp.com/vote/mz?user=#{msg.FromUserName}")
    uibe_vote = Weixin.item("对外经贸大学2016十佳歌手|内附歌曲音频", "比赛之前，先睹为快", 
      "http://fanhe-photo.b0.upaiyun.com/voter/uibe_vote_cover.jpg", "http://xnm.fanheapp.com/vote/uibe?user=#{msg.FromUserName}")
    bh_vote = Weixin.item("北京航空航天大学2016十佳歌手|内附歌曲音频", "比赛之前，先睹为快", 
      "http://fanhe-photo.b0.upaiyun.com/voter/bh_vote_cover.jpg", "http://xnm.fanheapp.com/vote/bh?user=#{msg.FromUserName}")
    zc_vote = Weixin.item("中央财经大学人气歌手投票｜这次你们会把谁推上谜の人气的宝座？", "投票呀，废什么话", 
      "http://fanhe-photo.b0.upaiyun.com/voter/zc_vote_cover.jpg", "http://xnm.fanheapp.com/vote/zc?user=#{msg.FromUserName}")
    bnu_vote = Weixin.item("北京师范大学人气歌手投票｜这次你们会把谁推上谜の人气的宝座？", "投票呀，废什么话", 
      "http://fanhe-photo.b0.upaiyun.com/voter/bnu_vote_cover.jpg", "http://xnm.fanheapp.com/vote/bnu?user=#{msg.FromUserName}")
    zf_vote = Weixin.item("中国政法大学人气歌手投票｜这次你们会把谁推上谜の人气的宝座？", "投票呀，废什么话", 
      "http://fanhe-photo.b0.upaiyun.com/voter/zf_vote_cover.jpg", "http://xnm.fanheapp.com/vote/zf?user=#{msg.FromUserName}")
    case msg.MsgType
    when 'text'
      if msg.Content == "动画歌曲"
        return Weixin.text_msg(msg.ToUserName, msg.FromUserName, "厚脸皮过儿童节的大朋友你好。
小师妹已备超大礼包恭候多时：
动
手
拆
吧

网球王子  
http://t.cn/RZ8imBt
数码暴龙  
http://t.cn/R5USQ2R
小糊涂神 
http://t.cn/R5US825
舒克贝塔  
http://t.cn/RhRCXCv
阿凡提  
http://t.cn/R5USEDe
大头儿子和小头爸爸  
http://t.cn/R5USuPb
哪吒传奇 
http://t.cn/R5US3Gj
犬夜叉
http://t.cn/R5US15o
更多国产动画片主题曲合集
http://t.cn/R5USBU0")
      end
      if bk_index.key? msg.Content
        bk_item = Weixin.item("北京科技大学校歌赛决赛选手—#{msg.Content}", "进来听完整音乐的，都是真爱。", 
        "http://fanhe-photo.b0.upaiyun.com/voter/images/bk_wechat_#{bk_index[msg.Content]}.jpg", bk_url[msg.Content])
        return Weixin.news_msg(msg.ToUserName, msg.FromUserName, [bk_item])
      end
      if by_index.key? msg.Content
        by_item = Weixin.item("北京语言大学校歌赛决赛选手—#{msg.Content}", "进来听完整音乐的，都是真爱。", 
        "http://fanhe-photo.b0.upaiyun.com/voter/images/by_wechat_#{by_index[msg.Content]}.jpg", by_url[msg.Content])
        return Weixin.news_msg(msg.ToUserName, msg.FromUserName, [by_item])
      end
      if bj_index.key? msg.Content
        bj_item = Weixin.item("北京交通大学校歌赛决赛选手—#{msg.Content}", "进来听完整音乐的，都是真爱。", 
        "http://fanhe-photo.b0.upaiyun.com/voter/images/bj_wechat_#{bj_index[msg.Content]}.jpg", bj_url[msg.Content])
        return Weixin.news_msg(msg.ToUserName, msg.FromUserName, [bj_item])
      end
      if uibe_index.key? msg.Content
        uibe_item = Weixin.item("对外经贸大学校歌赛决赛选手—#{msg.Content}", "进来听完整音乐的，都是真爱。", 
        "http://fanhe-photo.b0.upaiyun.com/voter/images/uibe_wechat_#{uibe_index[msg.Content]}.jpg", uibe_url[msg.Content])
        return Weixin.news_msg(msg.ToUserName, msg.FromUserName, [uibe_item])
      end
      if bh_index.key? msg.Content
        bh_item = Weixin.item("北京航空航天大学校歌赛决赛选手—#{msg.Content}", "进来听完整音乐的，都是真爱。", 
        "http://fanhe-photo.b0.upaiyun.com/voter/images/bh_wechat_#{bh_index[msg.Content]}.jpg", bh_url[msg.Content])
        return Weixin.news_msg(msg.ToUserName, msg.FromUserName, [bh_item])
      end
      if zc_index.key? msg.Content
        zc_item = Weixin.item("中央财经大学校歌赛决赛选手—#{msg.Content}", "进来听完整音乐的，都是真爱。", 
        "http://fanhe-photo.b0.upaiyun.com/voter/images/zc_wechat_#{zc_index[msg.Content]}.jpg", zc_url[msg.Content])
        return Weixin.news_msg(msg.ToUserName, msg.FromUserName, [zc_item])
      end
    when 'event'
      case msg.Event
      when 'CLICK'
        case msg.EventKey
        when 'top10'
          return Weixin.news_msg(msg.ToUserName, msg.FromUserName, [zf_vote, bnu_vote, zc_vote, bh_vote, bj_vote, by_vote, uibe_vote, bk_vote, mz_vote])
        end
      when 'subscribe'
        return Weixin.news_msg(msg.ToUserName, msg.FromUserName, [zc_vote])
      end
    else
      "success"
    end
  end
  
end
